﻿using RJi.FanucInterface3.Common.Enum;

namespace RJi.FanucInterface3.Common;

public static class IReaderExtension
{
    /// <summary>
    ///     获取电池报警
    /// </summary>
    /// <param name="reader"></param>
    /// <returns>返回 true 则电池有电量报警</returns>
    public static bool GetBatteryAlarm(this IReader reader)
    {
        var uo = reader.ReadOutput(OutputType.Uo);
        if (uo is short[] shorts) return shorts[9] == 1;
        return false;
    }
}